﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Finance/FinanceMaster.master" AutoEventWireup="true" 
	CodeBehind="AccountList.aspx.cs" Inherits="WebApplication.Finance.AccountList" Theme="BaselineTheme" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<%@ Register src="../Controls/PageHeadingBarCtrl.ascx" tagname="PageHeadingBarCtrl" tagprefix="uc1" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:ConfirmButtonExtender ID="confirmButtonExtender" runat="server" 
	ConfirmText="Remove this account and all related records?" 
	TargetControlID="butObliterate"></asp:ConfirmButtonExtender>

<!-- Heading bar -->
<div style="margin:auto; margin-top:0px; width:810px;">
	<uc1:PageHeadingBarCtrl ID="pageHeadingBarCtrl" runat="server" Title="Account List" />
</div>

<!-- Search bar -->
<asp:Panel runat="server" ID="pnlSearch" CssClass="sectionPanel" >
<table border="0" class="DataTable" style="padding-left:10px";>
	<tr><td colspan="5" class="sectionHeading"><h4>Search</h4></td></tr>
	<tr>
		<td class="DataTableLabel">From:</td>
		<td>
			<asp:TextBox ID="txtSearchFrom" runat="server"></asp:TextBox>
			<asp:CalendarExtender ID="calSearchFrom" runat="server" 
				TargetControlID="txtSearchFrom" Format="dd/MM/yyyy"></asp:CalendarExtender>
		</td>
		<td class="DataTableLabel" style="padding-left:12px;">To:</td>
		<td>
			<asp:TextBox ID="txtSearchTo" runat="server"></asp:TextBox>
			<asp:CalendarExtender ID="calSearchTo" runat="server" 
				TargetControlID="txtSearchTo" Format="dd/MM/yyyy"></asp:CalendarExtender>
		</td>
		<td class="DataTableLabel" style="padding-left:12px;">Client:</td>
		<td><asp:TextBox ID="txtSearchClient" runat="server"></asp:TextBox></td>
		<td style="padding-left:12px;"><asp:Button ID="butSearch" runat="server" 
				Text="Search" onclick="butSearch_Click" /></td>
	</tr>
	<tr style="vertical-align:top;">
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td></td>
		<td><span class="Instructions">(or leave blank)</span></td>
		<td></td>
	</tr>
</table>
</asp:Panel>

<!-- Account List -->
<asp:Panel runat="server" ID="pnlAccountList" CssClass="sectionPanel" >
<table border="0" class="DataTable" style="padding-left:10px";>
	<tr><td class="sectionHeading"><h4>Accounts</h4></td></tr>
	<tr><td>
	<asp:GridView ID="gridAccounts" runat="server" AutoGenerateColumns="False" 
			BorderStyle="None" DataKeyNames="AccountId"
			GridLines="Horizontal" onrowcommand="gridAccounts_RowCommand" 
			onrowdatabound="gridAccounts_RowDataBound">
		<Columns>
			<asp:BoundField HeaderText="Client">
				<HeaderStyle HorizontalAlign="Left" />
				<ItemStyle Width="120px" />
			</asp:BoundField>
			<asp:BoundField HeaderText="Contact">
				<HeaderStyle HorizontalAlign="Left" />
				<ItemStyle Width="120px" />
			</asp:BoundField>
			<asp:BoundField HeaderText="Manager">
				<HeaderStyle HorizontalAlign="Left" />
				<ItemStyle Width="110px" />
			</asp:BoundField>
			<asp:BoundField HeaderText="Collector">
				<HeaderStyle HorizontalAlign="Left" />
				<ItemStyle Width="110px" />
			</asp:BoundField>
			<asp:BoundField HeaderText="Inv">
				<HeaderStyle HorizontalAlign="Left" />
				<ItemStyle Width="30px" />
			</asp:BoundField>
			<asp:BoundField HeaderText="Total">
				<HeaderStyle HorizontalAlign="Left" />
				<ItemStyle Width="80px" />
			</asp:BoundField>
			<asp:BoundField DataField="FRLReference" HeaderText="FRL Ref">
				<HeaderStyle HorizontalAlign="Left" />
				<ItemStyle Width="100px" />
			</asp:BoundField>
			<asp:BoundField DataField="DebtorName" HeaderText="Debtor">
				<HeaderStyle HorizontalAlign="Left" />
				<ItemStyle Width="100px" />
			</asp:BoundField>
			<asp:BoundField HeaderText="Trading Style">
				<HeaderStyle HorizontalAlign="Left" />
				<ItemStyle Width="80px" />
			</asp:BoundField>
			<asp:CommandField ButtonType="Link" SelectText="Details" ShowSelectButton="true" >
			</asp:CommandField>
		</Columns>
		<HeaderStyle Font-Names="Arial" Font-Size="9pt" Font-Bold="true" HorizontalAlign="Left" />
		<RowStyle Font-Names="Arial" Font-Size="9pt" HorizontalAlign="Left" />
	</asp:GridView>	
	</td></tr>
</table>
</asp:Panel>

<!-- Account Details -->
<asp:Panel runat="server" ID="pnlAccountDetails" CssClass="sectionPanel" >
<table border="0" class="DataTable" style="padding-left:10px";>
	<tr><td colspan="2" class="sectionHeading"><h4>Account Details</h4></td></tr>
	<tr>
		<td>&nbsp;&nbsp;&nbsp;</td>
		<td>
			<table>
				<tr>
					<td class="DataTableLabel">FRL Ref:</td>
					<td class="DataTableValue"><asp:Literal ID="ltFRLRef" runat="server"></asp:Literal></td>
					<td>&nbsp;&nbsp;</td>
					<td class="DataTableLabel">Manager:</td>
					<td class="DataTableValue"><asp:Literal ID="ltManager" runat="server"></asp:Literal></td>
				</tr>
				<tr>
					<td class="DataTableLabel">Client Ref:</td>
					<td class="DataTableValue"><asp:Literal ID="ltClientRef" runat="server"></asp:Literal></td>
					<td>&nbsp;&nbsp;</td>
					<td class="DataTableLabel">Collector:</td>
					<td class="DataTableValue"><asp:Literal ID="ltCollector" runat="server"></asp:Literal></td>
				</tr>
				<tr>
					<td class="DataTableLabel">Debtor:</td>
					<td class="DataTableValue"><asp:Literal ID="ltDebtor" runat="server"></asp:Literal></td>
					<td>&nbsp;&nbsp;</td>
					<td class="DataTableLabel">Validated:</td>
					<td class="DataTableValue"><asp:Literal ID="ltValidated" runat="server"></asp:Literal></td>
				</tr>
				<tr>
					<td class="DataTableLabel">Trading Style:</td>
					<td class="DataTableValue"><asp:Literal ID="ltTradingStyle" runat="server"></asp:Literal></td>
					<td>&nbsp;&nbsp;</td>
				</tr>				
			</table>
		</td>
	</tr>
	<tr><td colspan="2" class="sectionHeading"><h4>Account Invoices</h4></td></tr>
	<tr>
		<td>&nbsp;&nbsp;&nbsp;</td>
		<td >
			<asp:GridView ID="gridInvoices" runat="server" AutoGenerateColumns="False" 
			BorderStyle="None" DataKeyNames="AccountInvoiceId"
			GridLines="Horizontal" onrowdatabound="gridInvoices_RowDataBound">
			<Columns>
				<asp:BoundField DataField="InvoiceDate" DataFormatString="{0:dd-MMM-yyyy}" HeaderText="Arrived">
					<HeaderStyle HorizontalAlign="Left" />
					<ItemStyle Width="90px" />
				</asp:BoundField>
				<asp:BoundField DataField="InvoiceNo" HeaderText="InvoiceNo">
					<HeaderStyle HorizontalAlign="Left" />
					<ItemStyle Width="80px" />
				</asp:BoundField>
				<asp:BoundField DataField="Amount" HeaderText="Amount">
					<HeaderStyle HorizontalAlign="Left" />
					<ItemStyle Width="80px" />
				</asp:BoundField>
				<asp:BoundField DataField="Status" HeaderText="Status">
					<HeaderStyle HorizontalAlign="Left" />
					<ItemStyle Width="120px" />
				</asp:BoundField>
				<asp:BoundField DataField="WorkflowId" HeaderText="Workflow">
					<HeaderStyle HorizontalAlign="Left" />
					<ItemStyle Width="120px" />
				</asp:BoundField>
				<asp:BoundField DataField="WorkflowDay1" HeaderText="Workflow Day1">
					<HeaderStyle HorizontalAlign="Left" />
					<ItemStyle Width="120px" />
				</asp:BoundField>
			</Columns>
		</asp:GridView></td>
	</tr>
	<tr><td colspan="2" class="sectionHeading"><h4>Account Notes</h4></td></tr>
	<tr>
		<td></td>
		<td><asp:GridView ID="gridNotes" runat="server" AutoGenerateColumns="False" 
			BorderStyle="None" DataKeyNames="AccountNoteId" GridLines="Horizontal" 
				onrowdatabound="gridNotes_RowDataBound">
			<Columns>
				<asp:BoundField DataField="Timestamp" HeaderText="Date">
					<HeaderStyle HorizontalAlign="Left" />
					<ItemStyle Width="128px" />
				</asp:BoundField>
				<asp:TemplateField HeaderText="Narrative">
					<ItemTemplate>
						<asp:Literal runat="server" Text='<%# Eval("Narrative") %>' /><br />
						<span style="color:Red;"><asp:Literal ID="Literal1" runat="server" Text='<%# Eval("Error") %>' /></span>
					</ItemTemplate>
					<ItemStyle Width="300px" />
					<HeaderStyle HorizontalAlign="Left" />
				</asp:TemplateField>
				<asp:BoundField DataField="UserDescription" HeaderText="Author">
					<HeaderStyle HorizontalAlign="Left" />
					<ItemStyle Width="120px" />
				</asp:BoundField>
				<asp:BoundField DataField="Flags" HeaderText="Flags">
					<HeaderStyle HorizontalAlign="Left" />
					<ItemStyle Width="140px" />
				</asp:BoundField>
			</Columns>
			<RowStyle HorizontalAlign="Left" />
			<HeaderStyle HorizontalAlign="Left" />
		</asp:GridView></td>
	</tr>
	<tr><td colspan="2" class="sectionHeading"><h4>Options</h4></td></tr>
	<tr><td colspan="2">
		<asp:Button ID="butSendLetter" runat="server" Text="Letter" onclick="butSendLetter_Click" />&nbsp;
		<asp:Button ID="butSendSMS" runat="server" Text="SMS" onclick="butSendSMS_Click" />&nbsp;
		<asp:Button ID="butSendFax" runat="server" Text="Fax" onclick="butSendFax_Click" />&nbsp;
		<asp:Button ID="butSendEmail" runat="server" Text="Email" onclick="butSendEmail_Click" />&nbsp;
		<asp:Button ID="butObliterate" runat="server" Text="Obliterate" onclick="butObliterate_Click" />
	</td></tr>
	<asp:Panel runat="server" ID="pnlSendComm">
	<tr>
		<td></td>
		<td>
			<table>
				<tr>
					<td>Body:</td>
					<td><asp:DropDownList ID="cboBody" runat="server"></asp:DropDownList></td>
				</tr>
				<tr>
					<td>Invoices:</td>
					<td><asp:CheckBoxList ID="chkListInvoice" runat="server"></asp:CheckBoxList></td>
				</tr>
				<tr>
					<td>Target:</td>
					<td><asp:DropDownList ID="cboTarget" runat="server" onselectedindexchanged="cboTarget_SelectedIndexChanged" AutoPostBack="true" ></asp:DropDownList></td>
				</tr>
				<tr>
					<td>Points:</td>
					<td><asp:CheckBoxList ID="chkTargetPoints" runat="server"></asp:CheckBoxList></td>
				</tr>
				<tr>
					<td></td>
					<td><asp:Button ID="butSendComm" runat="server" Text="Send" onclick="butSendComm_Click" />&nbsp;<asp:Button ID="butCancelComm" runat="server" Text="Cancel" onclick="butCancelComm_Click" /></td>
				</tr>
			</table>
		</td>
	</tr>
	</asp:Panel>
</table>
</asp:Panel>

<!-- Links -->
<div style="margin:auto; padding-top:32px; width:810px; text-align:right;">
<asp:hyperlink ID="hypDevCreateAccount" runat="server" class="BaselineLinkStyle" NavigateUrl="~/Finance/CreateAccount.aspx">Create Account</asp:hyperlink><br />
</div>

</asp:Content>
